package com.dht.xiao.jianye.activity;

import android.os.Build;
import android.os.Bundle;
import android.provider.Settings;
import android.support.v7.widget.GridLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.text.TextUtils;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;

import com.dht.xiao.jianye.R;
import com.dht.xiao.jianye.adapter.RecyclerAdapter;
import com.dht.xiao.jianye.base.BaseActivity;
import com.dht.xiao.jianye.bean.EndReadBean;
import com.dht.xiao.jianye.bean.SimpleBean;
import com.dht.xiao.jianye.http.MainHttp;
import com.licheedev.myutils.LogPlus;
import com.trello.rxlifecycle2.android.ActivityEvent;

import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.TimeUnit;

import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;
import cn.dlc.commonlibrary.okgo.rx.OkObserver;
import cn.dlc.commonlibrary.utils.ToastUtil;
import io.reactivex.Observable;
import io.reactivex.android.schedulers.AndroidSchedulers;
import io.reactivex.functions.Consumer;
import io.reactivex.schedulers.Schedulers;

public class RecycleActivity extends BaseActivity {

    String ANDROID_ID;
    @BindView(R.id.send)
    TextView send;
    @BindView(R.id.tv_nums)
    TextView tvNums;
    @BindView(R.id.recycler_customer)
    RecyclerView mRecyclerView;
    @BindView(R.id.btn_read)
    Button btnRead;
    @BindView(R.id.seriesNum)
    TextView seriesNum;

    private RecyclerAdapter mRecyclerAdapter;

    @Override
    protected int getLayoutId() {
        return R.layout.activity_recycle;
    }

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_recycle);
        ButterKnife.bind(this);
        getMachineCode();
        initRecyclerView();
    }

    private void initRecyclerView() {
        mRecyclerView.setLayoutManager(new GridLayoutManager(getActivity(), 2));
        mRecyclerView.setOverScrollMode(View.OVER_SCROLL_NEVER);
        mRecyclerAdapter = new RecyclerAdapter();
        mRecyclerView.setAdapter(mRecyclerAdapter);


    }

    private void getMachineCode() {
        ANDROID_ID =
                Settings.System.getString(getContentResolver(), Settings.System.ANDROID_ID);
        if (TextUtils.isEmpty(ANDROID_ID)) {
            ANDROID_ID = Build.SERIAL;
        }
        LogPlus.e("ANDROID_ID =" + ANDROID_ID);
        //ANDROID_ID = "6f4b9da9f38b5566";
        seriesNum.setText(ANDROID_ID);

    }








}
